export const fun = function() {
    (function() {
        if (!POOLS) {
            var POOLS = {};

            // 一定
            POOLS["d1"] = {};
            for (var i = 0; i < 5; i++) {

                var pools = [];
                for (var ii = 0; ii < 10; ii++) {
                    var p = "XXXXX".split('');
                    p[i] = ii + '';
                    pools.push(p.join(''));
                }
                POOLS["d1"]['' + i] = pools

            }

            // 二定
            POOLS["d2"] = {};
            for (var i = 0; i < 5; i++) {
                for (var j = i + 1; j < 5; j++) {

                    var pools = [];
                    for (var ii = 0; ii < 10; ii++) {
                        for (var jj = 0; jj < 10; jj++) {
                            var p = "XXXXX".split('');
                            p[i] = ii + '';
                            p[j] = jj + '';
                            pools.push(p.join(''));
                        }
                    }
                    POOLS["d2"]['' + i + j] = pools;

                }
            }

            // 三定
            POOLS["d3"] = {};
            for (var i = 0; i < 5; i++) {
                for (var j = i + 1; j < 5; j++) {
                    for (var k = j + 1; k < 5; k++) {

                        var pools = [];
                        for (var ii = 0; ii < 10; ii++) {
                            for (var jj = 0; jj < 10; jj++) {
                                for (var kk = 0; kk < 10; kk++) {
                                    var p = "XXXXX".split('');
                                    p[i] = ii + '';
                                    p[j] = jj + '';
                                    p[k] = kk + '';
                                    pools.push(p.join(''));
                                }
                            }
                        }
                        POOLS["d3"]['' + i + j + k] = pools;

                    }
                }
            }

            // 四定
            POOLS["d4"] = {};
            for (var i = 0; i < 5; i++) {
                for (var j = i + 1; j < 5; j++) {
                    for (var k = j + 1; k < 5; k++) {
                        for (var m = k + 1; m < 5; m++) {

                            var pools = [];
                            for (var ii = 0; ii < 10; ii++) {
                                for (var jj = 0; jj < 10; jj++) {
                                    for (var kk = 0; kk < 10; kk++) {
                                        for (var mm = 0; mm < 10; mm++) {
                                            var p = "XXXXX".split('');
                                            p[i] = ii + '';
                                            p[j] = jj + '';
                                            p[k] = kk + '';
                                            p[m] = mm + '';
                                            pools.push(p.join(''));
                                        }
                                    }
                                }
                            }
                            POOLS["d4"]['' + i + j + k + m] = pools;

                        }
                    }
                }
            }

            function count_unique() {
                var a = arguments;
                var b = [];
                for (var a1 of a) {
                    var f = false;
                    for (var b1 of b) {
                        if (b1 == a1) { f = true; break }
                    }
                    if (!f) { b.push(a1) }
                }
                return b.length;
            }

            // 二字、三字、四字
            POOLS["z2"] = {};
            POOLS["z3"] = {};
            POOLS["z4"] = {};
            for (var i = 0; i < 10; i++) {
                for (var j = i; j < 10; j++) {
                    var c = '' + count_unique(i, j);
                    if (!POOLS["z2"][c]) POOLS["z2"][c] = [];
                    POOLS["z2"][c].push('' + i + j);
                    for (var k = j; k < 10; k++) {
                        c = '' + count_unique(i, j, k);
                        if (!POOLS["z3"][c]) POOLS["z3"][c] = [];
                        POOLS["z3"][c].push('' + i + j + k);
                        for (var m = k; m < 10; m++) {
                            c = '' + count_unique(i, j, k, m);
                            if (!POOLS["z4"][c]) POOLS["z4"][c] = [];
                            POOLS["z4"][c].push('' + i + j + k + m);
                        }
                    }
                }
            }

            localStorage["POOLS"] = JSON.stringify(POOLS);
        }
    })();

}



export const fast = function() {

    $(function() {
        // program.muiInit();
        program.nav();
        program.dingAndPei();
        program.bdwClick();
        program.cClick();
        program.xdClick();
        program.dsClick();
        program.dansClick();
        program.clear();
        $('.btn').click(function() {
            program.submit();
        })
    })

    var program = {
        // muiInit: function () {
        //   mui('.mui-scroll-wrapper').scroll({
        //     deceleration: 0.0005
        //   });
        // },
        submit: function() {
            var that = this
            if (that.data.nav == 1 && (that.data.ruleOne == 1 || that.data.ruleOne == 2)) {
                that.data.dpInput = ['#w', '#q', "#b", "#s", "#g"]
            }
            if (that.data.nav == 1 && (that.data.ruleOne == 3 || that.data.ruleOne == 4)) {
                that.data.dpInput = ['#area-one', '#area-two']
            }
            if (that.data.nav == 2 && (that.data.ruleOne == 1 || that.data.ruleOne == 2)) {
                that.data.dpInput = ['#w', '#q', "#b", "#s", "#g"]
            }
            if (that.data.nav == 2 && (that.data.ruleOne == 3 || that.data.ruleOne == 4)) {
                that.data.dpInput = ['#area-one', '#area-two', '#area-three']
            }
            if (that.data.nav == 3 && (that.data.ruleOne == 1 || that.data.ruleOne == 2)) {
                that.data.dpInput = ['#w', '#q', "#b", "#s", "#g"]
            }
            if (that.data.nav == 3 && (that.data.ruleOne == 3 || that.data.ruleOne == 4)) {
                that.data.dpInput = ['#area-one', '#area-two', '#area-three', '#area-four']
            }
            if (that.data.nav == 4 && (that.data.ruleOne == 3 || that.data.ruleOne == 4)) {
                that.data.dpInput = ['#area-one', '#area-two']
            }
            if (that.data.nav == 5 && (that.data.ruleOne == 3 || that.data.ruleOne == 4)) {
                that.data.dpInput = ['#area-one', '#area-two', '#area-three']
            }
            if (that.data.nav == 6 && (that.data.ruleOne == 3 || that.data.ruleOne == 4)) {
                that.data.dpInput = ['#area-one', '#area-two', '#area-three', '#area-four']
            }
            var dpInputGet = that.getInput(that.data.dpInput)
            var num = dpInputGet.num
            var place = dpInputGet.place
            that.data.navAlldata = that.getNavAlldata(dpInputGet)
                //定位置和配数全转
            that.data.navAlldata = that.dpFun(num, place, that.data.navAlldata, dpInputGet)
                //合分
            that.data.navAlldata = that.hfFun(that.data.navAlldata, dpInputGet)
                //不定位合分
            that.data.navAlldata = that.bdwFun(that.data.navAlldata, dpInputGet)
                // //多重
            that.data.navAlldata = that.cFun(that.data.navAlldata, dpInputGet);
            // //兄弟
            that.data.navAlldata = that.xdFun(that.data.navAlldata, dpInputGet)
                // //对数
            that.data.navAlldata = that.dsFun(that.data.navAlldata, dpInputGet)
                // //单双
            that.data.navAlldata = that.dansFun(that.data.navAlldata, dpInputGet)
                //结果处理
            that.data.navAlldata = that.removeSame(that.data.navAlldata)
            that.resultList(that.data.navAlldata)
            console.log(that.data.navAlldata, 88)
        },
        data: {
            nav: 1, //导航
            navAlldata: [],
            dpInput: [], //获取输入框的类容
            ruleOne: 1, //定 取1除2 配数 取3除4
            hfNum: '-1', //合分
            ruleThree: 1,
            ruleFour: '-1', //多重
            ruleFive: '-1', //兄弟
            ruleSix: '-1', //对数
            ruleSeven1: '-1', //单
            ruleSeven2: '-1', //双
        },
        nav: function() {
            let that = this
            $('.noDing-two,.noDing-three').css('display', 'none')
            $('.nav li').click(function() {
                $(this).addClass('curLi').siblings().removeClass();
                that.data.nav = Number($(this).attr('data-id'))
                console.log(that.data.nav)
                switch (that.data.nav) {
                    case 1:
                    case 2:
                    case 3:
                        that.data.ruleOne = 1;
                        $('.choose-two').css('display', 'block')
                        $('#one-first').prop('checked', true)
                        $('.one-all-first,#ding').css('display', 'flex')
                        $('.one-all-second').css('display', 'none')
                        break;
                    case 4:
                    case 5:
                    case 6:
                        that.data.ruleOne = 3;
                        $('.choose-two').css('display', 'none')
                        $('#one-third').prop('checked', true)
                        $('.one-all-first,#ding').css('display', 'none')
                        $('.one-all-second').css('display', 'flex')
                        if (that.data.nav == 4) {
                            $('#area-one,#area-two').css('display', 'flex')
                            $('#area-three,#area-four').css('display', 'none')
                        }
                        if (that.data.nav == 5) {
                            $('#area-one,#area-two,#area-three').css('display', 'flex')
                            $('#area-four').css('display', 'none')
                        }
                        if (that.data.nav == 6) {
                            $('#area-one,#area-two,#area-three,#area-four').css('display', 'flex')
                        }
                        break;
                }
                switch (that.data.nav) {
                    case 1:
                    case 4:
                        $('.noDing-one').css('display', 'flex')
                        $('.noDing-two,.noDing-three').css('display', 'none')
                        break;
                    case 2:
                    case 5:
                        $('.noDing-one,.noDing-two').css('display', 'flex')
                        $('.noDing-three').css('display', 'none')
                        break;
                    case 3:
                    case 6:
                        $('.noDing-one,.noDing-two,.noDing-three').css('display', 'flex')
                        break;
                }
            })
        },
        dingAndPei: function() {
            let that = this
            var name = ['#one-first', '#one-second', '#one-third', '#one-fourth']
            name.forEach(item => {
                $(item).click(function() {
                    that.data.ruleOne = $(this).attr('data-id')
                    console.log(that.data.ruleOne)
                    if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                        $('.one-all-first').css('display', 'none')
                        $('.one-all-second').css('display', 'flex')
                        switch (that.data.nav) {
                            case 1:
                            case 4:
                                $('#area-one,#area-two').css('display', 'flex')
                                $('#area-three,#area-four').css('display', 'none')
                                break;
                            case 2:
                            case 5:
                                $('#area-one,#area-two,#area-three').css('display', 'flex')
                                $('#area-four').css('display', 'none')
                                break;
                            case 3:
                            case 6:
                                $('#area-one,#area-two,#area-three,#area-four').css('display', 'flex')
                                break;
                        }
                    } else {
                        $('.one-all-first').css('display', 'flex')
                        $('.one-all-second').css('display', 'none')
                    }
                })
            })
        },
        //获取input中的值
        getInput: function(name) {
            var that = this
            var num = []
            var place = []
            for (var i = 0; i < name.length; i++) {
                if ($(name[i]).val() != "") {
                    num.push($(name[i]).val())
                    place.push(i)
                }
            }
            return {
                num: num,
                place: place
            }
        },
        // 获取当前规则的数据集合
        getPools: function(name, name2, type) {
            var numbers = JSON.parse(localStorage.getItem('POOLS'))[name]
            var numbersName = Object.keys(numbers)
            var dataList = []
            var params = []
                //获取所有
            if (type == 1) {
                for (var i = 0; i < numbersName.length; i++) {
                    for (var j = 0; j < numbers[numbersName[i]].length; j++) {
                        dataList.push(numbers[numbersName[i]][j])
                    }
                }
            } else {
                //获取当前位置
                var name2Arr = name2
                for (var i = 0; i < name2Arr.length; i++) {
                    params = []
                    for (var j = 0; j < numbersName.length; j++) {
                        if (numbersName[j].indexOf(name2Arr[i]) >= 0) {
                            params.push(numbersName[j])
                        }
                    }
                    numbersName = params
                }
                for (var i = 0; i < params.length; i++) {
                    for (var j = 0; j < numbers[params[i]].length; j++) {
                        dataList.push(numbers[params[i]][j])
                    }
                }
            }
            return dataList
        },
        //获取数据当前总量
        getNavAlldata: function(dpInputGet) {
            var that = this;
            var pools = [] //获取总值
            switch (Number(that.data.nav)) {
                case 1:
                    if (that.data.ruleOne == 1 || that.data.ruleOne == 2) {
                        if (dpInputGet.num.length >= 3) {
                            pools = []
                        } else if (dpInputGet.num.length == 0) {
                            pools = that.getPools('d2', dpInputGet.place, 1)
                        } else {
                            pools = that.getPools('d2', dpInputGet.place, 2)
                        }
                    }
                    if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                        pools = that.getPools('d2', '', 1)
                    }
                    break;
                case 2:
                    if (that.data.ruleOne == 1 || that.data.ruleOne == 2) {
                        if (dpInputGet.num.length >= 4) {
                            pools = []
                        } else if (dpInputGet.num.length == 0) {
                            pools = that.getPools('d3', dpInputGet.place, 1)
                        } else {
                            pools = that.getPools('d3', dpInputGet.place, 2)
                        }
                    }
                    if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                        pools = that.getPools('d3', '', 1)
                    }
                    break;
                case 3:
                    if (that.data.ruleOne == 1 || that.data.ruleOne == 2) {
                        if (dpInputGet.num.length >= 5) {
                            pools = []
                        } else if (dpInputGet.num.length == 0) {
                            pools = that.getPools('d4', dpInputGet.place, 1)
                        } else {
                            pools = that.getPools('d4', dpInputGet.place, 2)
                        }
                    }
                    if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                        pools = that.getPools('d4', '', 1)
                    }
                    break;
                case 4:
                    if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                        pools = that.getPools('z2', '', 1)
                    }
                    break;
                case 5:
                    if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                        pools = that.getPools('z3', '', 1)
                    }
                    break;
                case 6:
                    if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                        pools = that.getPools('z4', '', 1)
                    }
                    break;
            }
            return pools

        },
        dpFun: function(num, place, navAlldata, dpInputGet) {
            var that = this
                //取
            var params = []
            for (var i = 0; i < num.length; i++) {
                params = []
                for (var j = 0; j < num[i].length; j++) {
                    for (var k = 0; k < navAlldata.length; k++) {
                        if (that.data.ruleOne == 1 || that.data.ruleOne == 2) {
                            if (navAlldata[k][place[i]] == num[i][j]) {
                                params.push(navAlldata[k])
                            }
                        }
                        if (that.data.ruleOne == 3 || that.data.ruleOne == 4) {
                            if (navAlldata[k].indexOf(num[i][j]) >= 0) {
                                params.push(navAlldata[k])
                            }
                        }
                    }
                }
                navAlldata = that.removeSame(params)
                    // 除
                if (that.data.ruleOne == 2 || that.data.ruleOne == 4) {
                    var allData = that.getNavAlldata(dpInputGet) //初始data
                    for (var i = 0; i < navAlldata.length; i++) {
                        for (var j = 0; j < allData.length; j++) {
                            if (navAlldata[i] == allData[j]) {
                                allData.splice(j, 1)
                            }
                        }
                    }
                    navAlldata = allData
                }
            }
            if (num.length <= 0) {
                navAlldata = []
            }
            return navAlldata
        },
        //合分
        hfFun: function(navAlldata, dpInputGet) {
            const countOccurences = (arr, value) => arr.reduce((a, v) => v === value ? a + 1 : a + 0, 0);
            var that = this
            var params = [];
            var place = [];
            var num = [];
            for (var i = 0; i < 25; i++) {
                if ($("input[name = all-two-child]:eq(" + i + ")").prop('checked')) {
                    place.push($("input[name = all-two-child]:eq(" + i + ")").attr('data-id') - 1)
                } else {
                    place.push(false)
                }
                if (i < 5) {
                    num.push($("input[name = two-input]:eq(" + i + ")").val())
                }
            }
            if (
                $('#two-first').val() == '' &&
                $('#two-second').val() == '' &&
                $('#two-third').val() == '' &&
                $('#two-fourth').val() == '' &&
                $('#two-fifth').val() == ''
            ) {
                that.data.hfNum = '-1'
                return navAlldata
            } else {
                that.data.hfNum = '1'
            }
            //初始化数据
            if (dpInputGet.num.length <= 0) {
                navAlldata = that.getNavAlldata(dpInputGet)
            }
            console.log(navAlldata, 555)
                // 1
            var place1 = place.slice(0, 5)
            var contleng = countOccurences(place1, false)
            if (contleng == 3 && num[0] != "") {
                place1 = JSON.stringify(place1).replace(/false/g, '').replace(/[,\"\[\]]/g, '')
                var num1 = num[0].split('')
                for (var i = 0; i < navAlldata.length; i++) {
                    if (navAlldata[i][place1[0]] != 'X' && navAlldata[i][place1[1]] != 'X') {
                        var data = (Number(navAlldata[i][place1[0]]) + Number(navAlldata[i][place1[1]])).toString().split('')
                        if (that.checkArr(data, num1)) {
                            params.push(navAlldata[i])
                        }
                    }
                }
                navAlldata = params;
            }
            // 2
            var place2 = place.slice(5, 10)
            var contleng = countOccurences(place2, false)
            if (contleng == 3 && num[1] != "") {
                params = []
                place2 = JSON.stringify(place2).replace(/false/g, '').replace(/[,\"\[\]]/g, '')
                var num2 = num[1].split('')
                for (var i = 0; i < navAlldata.length; i++) {
                    if (navAlldata[i][place2[0]] != 'X' && navAlldata[i][place2[1]] != 'X') {
                        var data = (Number(navAlldata[i][place2[0]]) + Number(navAlldata[i][place2[1]])).toString().split('')
                        if (that.checkArr(data, num2)) {
                            params.push(navAlldata[i])
                        }
                    }
                }
                navAlldata = params;
            }
            // 3
            var place3 = place.slice(10, 15)
            var contleng = countOccurences(place3, false)
            if (contleng == 3 && num[2] != "") {
                params = []
                place3 = JSON.stringify(place3).replace(/false/g, '').replace(/[,\"\[\]]/g, '')
                var num3 = num[2].split('')
                for (var i = 0; i < navAlldata.length; i++) {
                    if (navAlldata[i][place3[0]] != 'X' && navAlldata[i][place3[1]] != 'X') {
                        var data = (Number(navAlldata[i][place3[0]]) + Number(navAlldata[i][place3[1]])).toString().split('')
                        if (that.checkArr(data, num3)) {
                            params.push(navAlldata[i])
                        }
                    }
                }
                navAlldata = params;
            }
            // 4
            var place4 = place.slice(15, 20)
            var contleng = countOccurences(place4, false)
            if (contleng == 3 && num[3] != "") {
                params = []
                place4 = JSON.stringify(place4).replace(/false/g, '').replace(/[,\"\[\]]/g, '')
                var num4 = num[3].split('')
                for (var i = 0; i < navAlldata.length; i++) {
                    if (navAlldata[i][place4[0]] != 'X' && navAlldata[i][place4[1]] != 'X') {
                        var data = (Number(navAlldata[i][place4[0]]) + Number(navAlldata[i][place4[1]])).toString().split('')
                        if (that.checkArr(data, num4)) {
                            params.push(navAlldata[i])
                        }
                    }
                }
                navAlldata = params;
            }
            // 5
            var place5 = place.slice(20, 25)
            var contleng = countOccurences(place5, false)
            if (contleng == 3 && num[4] != "") {
                params = []
                place5 = JSON.stringify(place5).replace(/false/g, '').replace(/[,\"\[\]]/g, '')
                var num5 = num[4].split('')
                for (var i = 0; i < navAlldata.length; i++) {
                    if (navAlldata[i][place5[0]] != 'X' && navAlldata[i][place5[1]] != 'X') {
                        var data = (Number(navAlldata[i][place5[0]]) + Number(navAlldata[i][place5[1]])).toString().split('')
                        if (that.checkArr(data, num5)) {
                            params.push(navAlldata[i])
                        }
                    }
                }
                navAlldata = params;
            }
            return params
        },
        //不定位
        bdwClick: function() {
            var that = this
            var name = ['#noDing-one', '#noDing-two', '#noDing-three']
            name.forEach(item => {
                $(item).click(function() {
                    that.data.ruleThree = $(this).attr('data-id')
                    console.log(that.data.ruleThree)
                })
            })
        },
        bdwFun: function(navAlldata, dpInputGet) {
            var that = this
            var bdwData = []
            var add = ''
            var addArr = []
            var bdwInput = $('#noDing-inputs').val()
            if (bdwInput.length <= 0) {
                return navAlldata
            }
            if (dpInputGet.num.length <= 0 && that.data.hfNum == '-1') {
                navAlldata = that.getNavAlldata(dpInputGet)
                console.log(navAlldata, 9)
            }
            switch (Number(that.data.ruleThree)) {
                case 1:
                    for (var i = 0; i < navAlldata.length; i++) {
                        var navAlldataArr = navAlldata[i].replace(/X/g, '')
                        for (var j = 0; j < navAlldataArr.length; j++) {
                            for (var k = 0; k < navAlldataArr.length; k++) {
                                if (j != k) {
                                    add = (Number(navAlldataArr[j]) + Number(navAlldataArr[k])).toString()
                                    addArr = add.split('')
                                    for (var m = 0; m < addArr.length; m++) {
                                        if (bdwInput.indexOf(addArr[m]) >= 0 || bdwInput == add) {
                                            bdwData.push(navAlldata[i])
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;
                case 2:
                    for (var i = 0; i < navAlldata.length; i++) {
                        var navAlldataArr = navAlldata[i].replace(/X/g, '')
                        for (var j = 0; j < navAlldataArr.length; j++) {
                            for (var k = 0; k < navAlldataArr.length; k++) {
                                for (var l = 0; l < navAlldataArr.length; l++) {
                                    if (j != k && j != l && k != l) {
                                        add = (Number(navAlldataArr[j]) + Number(navAlldataArr[k]) + Number(navAlldataArr[l])).toString()
                                        addArr = add.split('')
                                        for (var m = 0; m < addArr.length; m++) {
                                            if (bdwInput.indexOf(addArr[m]) >= 0 || bdwInput == add) {
                                                bdwData.push(navAlldata[i])
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;
                case 3:
                    for (var i = 0; i < navAlldata.length; i++) {
                        var navAlldataArr = navAlldata[i].replace(/X/g, '')
                        for (var j = 0; j < navAlldataArr.length; j++) {
                            for (var k = 0; k < navAlldataArr.length; k++) {
                                for (var l = 0; l < navAlldataArr.length; l++) {
                                    for (var m = 0; m < navAlldataArr.length; m++) {
                                        if (j != k && j != l && j != m && k != l && k != m && l != m) {
                                            add = (Number(navAlldataArr[j]) + Number(navAlldataArr[k]) + Number(navAlldataArr[l]) + Number(navAlldataArr[m])).toString()
                                            addArr = add.split('')
                                            for (var n = 0; n < addArr.length; n++) {
                                                if (bdwInput.indexOf(addArr[n]) >= 0 || bdwInput == add) {
                                                    bdwData.push(navAlldata[i])
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;
            }
            return bdwData
        },
        // 多重
        cClick: function() {
            var that = this
            $('input[name = four-all]').click(function() {
                $(this).siblings('input').prop('checked', false)
                $(this).parents().siblings().children('input').prop('checked', false)
                that.data.ruleFour = $(this).attr('data-id')
                if ($(this).prop('checked') == false) {
                    that.data.ruleFour = '-1'
                }
                console.log(that.data.ruleFour)
                console.log($(this).prop('checked'))
            })
        },
        cFun: function(navAlldata, dpInputGet) {
            var that = this
            var params = [];
            if (that.data.ruleFour == '-1') {
                return navAlldata
            }
            //初始化数据
            if (dpInputGet.num.length <= 0 && that.data.hfNum == '-1' && $('#noDing-inputs').val().length <= 0) {
                navAlldata = that.getNavAlldata(dpInputGet)
                console.log(navAlldata, 555)
            }
            // 双重
            if (that.data.ruleFour == 1 || that.data.ruleFour == 2) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    for (var j = 0; j < navAlldataArr.length; j++) {
                        for (var k = 0; k < navAlldataArr.length; k++) {
                            if (j != k && (navAlldataArr[j] == navAlldataArr[k])) {
                                params.push(navAlldata[i])
                            }
                        }
                    }
                }
            }
            // 双双重
            if (that.data.ruleFour == 3 || that.data.ruleFour == 4) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    for (var j = 0; j < navAlldataArr.length; j++) {
                        for (var k = 0; k < navAlldataArr.length; k++) {
                            for (var l = 0; l < navAlldataArr.length; l++) {
                                for (var m = 0; m < navAlldataArr.length; m++) {
                                    if ((j != k) && (j != l) && (j != m) && (k != l) && (k != m) && (l != m)) {
                                        if ((navAlldataArr[j] == navAlldataArr[k] && navAlldataArr[l] == navAlldataArr[m] && navAlldataArr[j] != navAlldataArr[l]) ||
                                            (navAlldataArr[j] == navAlldataArr[l] && navAlldataArr[k] == navAlldataArr[m] && navAlldataArr[j] != navAlldataArr[m]) ||
                                            (navAlldataArr[j] == navAlldataArr[m] && navAlldataArr[k] == navAlldataArr[l] && navAlldataArr[j] != navAlldataArr[l])
                                        ) {
                                            params.push(navAlldata[i])
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            // 三重
            if (that.data.ruleFour == 5 || that.data.ruleFour == 6) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    for (var j = 0; j < navAlldataArr.length; j++) {
                        for (var k = 0; k < navAlldataArr.length; k++) {
                            for (var l = 0; l < navAlldataArr.length; l++) {
                                if (j != k && j != l && k != l) {
                                    if (navAlldataArr[j] == navAlldataArr[k] &&
                                        navAlldataArr[j] == navAlldataArr[l] &&
                                        navAlldataArr[k] == navAlldataArr[l]) {
                                        params.push(navAlldata[i])
                                    }
                                }
                            }
                        }
                    }
                }
            }
            //四重
            if (that.data.ruleFour == 7 || that.data.ruleFour == 8) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    if (navAlldataArr[0] == navAlldataArr[1] &&
                        navAlldataArr[0] == navAlldataArr[2] &&
                        navAlldataArr[0] == navAlldataArr[3] &&
                        navAlldataArr[1] == navAlldataArr[2] &&
                        navAlldataArr[1] == navAlldataArr[3] &&
                        navAlldataArr[2] == navAlldataArr[3]) {
                        params.push(navAlldata[i])
                    }
                }
            }
            //除
            if (that.data.ruleFour == 2 || that.data.ruleFour == 4 || that.data.ruleFour == 6 || that.data.ruleFour == 8) {
                for (var i = 0; i < params.length; i++) {
                    for (var j = 0; j < navAlldata.length; j++) {
                        if (params[i] == navAlldata[j]) {
                            navAlldata.splice(j, 1)
                        }
                    }
                }
                params = navAlldata
            }
            return params
        },
        //兄弟
        xdClick: function() {
            var that = this
            $('input[name = five-all]').click(function() {
                $(this).siblings('input').prop('checked', false)
                $(this).parents().siblings().children('input').prop('checked', false)
                that.data.ruleFive = $(this).attr('data-id')
                if ($(this).prop('checked') == false) {
                    that.data.ruleFive = '-1'
                }
                console.log(that.data.ruleFive)
                console.log($(this).prop('checked'))
            })
        },
        xdFun: function(navAlldata, dpInputGet) {
            var that = this
            var params = [];
            var size = [1, -1, 9, -9]
            var size2 = [2, -2, 8, -8]
            var size3 = [3, -3, 7, -7]
            var size4 = [1, -1, 9, -9, 0]
            if (that.data.ruleFive == '-1') {
                return navAlldata
            }
            //初始化数据
            if (dpInputGet.num.length <= 0 && that.data.hfNum == '-1' && $('#noDing-inputs').val().length <= 0 && that.data.ruleFour == '-1') {
                navAlldata = that.getNavAlldata(dpInputGet)
                console.log(navAlldata, 555)
            }
            // 二兄弟
            if (that.data.ruleFive == 1 || that.data.ruleFive == 2) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    if (navAlldataArr.length == 2) {
                        if (
                            size.indexOf(navAlldataArr[0] - navAlldataArr[1]) >= 0
                        ) {
                            params.push(navAlldata[i])
                        }
                    }
                    if (navAlldataArr.length == 3) {
                        for (var j = 0; j < navAlldataArr.length; j++) {
                            for (var k = 0; k < navAlldataArr.length; k++) {
                                for (var l = 0; l < navAlldataArr.length; l++) {
                                    if (j != k && j != l && k != l) {
                                        if (
                                            size.indexOf(navAlldataArr[j] - navAlldataArr[k]) >= 0 &&
                                            size.indexOf(navAlldataArr[j] - navAlldataArr[l]) >= 0 &&
                                            navAlldataArr[k] == navAlldataArr[l]
                                        ) {
                                            params.push(navAlldata[i])
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (navAlldataArr.length == 4) {
                        var num = []
                        var nums = '9876543210'
                        for (var j = 0; j < nums.length; j++) {
                            if (navAlldataArr.indexOf(nums[j]) >= 0) {
                                num.push(j)
                            }
                        }
                        if (num.length == 2) {
                            for (var j = 0; j < navAlldataArr.length; j++) {
                                for (var k = 0; k < navAlldataArr.length; k++) {
                                    if (j != k) {
                                        if (
                                            size.indexOf(navAlldataArr[j] - navAlldataArr[k]) >= 0
                                        ) {
                                            params.push(navAlldata[i])
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            // 三兄弟
            if (that.data.ruleFive == 3 || that.data.ruleFive == 4) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    if (navAlldataArr.length == 3) {
                        for (var j = 0; j < navAlldataArr.length; j++) {
                            if (
                                size.indexOf(navAlldataArr[0] - navAlldataArr[1]) >= 0 &&
                                size.indexOf(navAlldataArr[1] - navAlldataArr[2]) >= 0 &&
                                size2.indexOf(navAlldataArr[2] - navAlldataArr[0]) >= 0
                            ) {
                                params.push(navAlldata[i])
                            }
                        }
                    }
                    if (navAlldataArr.length == 4) {
                        var num = []
                        var nums = '9876543210'
                        for (var j = 0; j < nums.length; j++) {
                            if (navAlldataArr.indexOf(nums[j]) >= 0) {
                                num.push(j)
                            }
                        }
                        if (num.length == 3) {
                            navAlldataArr = that.removeSame(navAlldataArr).toString().replace(/,/g, '')
                            if (
                                size.indexOf(navAlldataArr[0] - navAlldataArr[1]) >= 0 &&
                                size.indexOf(navAlldataArr[1] - navAlldataArr[2]) >= 0
                            ) {
                                params.push(navAlldata[i])
                            }
                        }
                    }
                }
            }
            //四兄弟
            if (that.data.ruleFive == 5 || that.data.ruleFive == 6) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    for (var j = 0; j < navAlldataArr.length; j++) {
                        if (
                            size.indexOf(navAlldataArr[0] - navAlldataArr[1]) >= 0 &&
                            size.indexOf(navAlldataArr[1] - navAlldataArr[2]) >= 0 &&
                            size.indexOf(navAlldataArr[2] - navAlldataArr[3]) >= 0 &&
                            size3.indexOf(navAlldataArr[3] - navAlldataArr[0]) >= 0
                        ) {
                            params.push(navAlldata[i])
                        }
                    }
                }
            }
            //除
            if (that.data.ruleFive == 2 || that.data.ruleFive == 4 || that.data.ruleFive == 6) {
                for (var i = 0; i < params.length; i++) {
                    for (var j = 0; j < navAlldata.length; j++) {
                        if (params[i] == navAlldata[j]) {
                            navAlldata.splice(j, 1)
                        }
                    }
                }
                params = navAlldata
            }
            return params;
        },
        //对数
        dsClick: function() {
            var that = this
            $('input[name = six-all]').click(function() {
                $(this).siblings('input').prop('checked', false)
                $(this).parents().siblings().children('input').prop('checked', false)
                that.data.ruleSix = $(this).attr('data-id')
                if ($(this).prop('checked') == false) {
                    that.data.ruleSix = '-1'
                }
                console.log(that.data.ruleSix)
                console.log($(this).prop('checked'))
            })
        },
        dsFun: function(navAlldata, dpInputGet) {
            var that = this
            var params = [];
            var name = ['#six-one', '#six-two', '#six-three']
            var sixData = that.getInput(name)
            if (that.data.ruleSix == '-1') {
                return navAlldata
            }
            //初始化数据
            if (dpInputGet.num.length <= 0 && that.data.hfNum == '-1' && $('#noDing-inputs').val().length <= 0 &&
                that.data.ruleFour == '-1' && that.data.ruleFive == '-1') {
                navAlldata = that.getNavAlldata(dpInputGet)
            }
            //求对数
            console.log(navAlldata, 555)
            if (that.data.ruleSix == 1 || that.data.ruleSix == 2) {
                for (var i = 0; i < navAlldata.length; i++) {
                    var navAlldataArr = navAlldata[i].replace(/X/g, '')
                    for (var j = 0; j < navAlldataArr.length; j++) {
                        for (var k = 0; k < navAlldataArr.length; k++) {
                            if (j != k) {
                                if (navAlldataArr[j] - navAlldataArr[k] == 5 || navAlldataArr[j] - navAlldataArr[k] == -5) {
                                    params.push(navAlldata[i])
                                }
                            }
                        }
                    }
                }
            }
            //除
            if (that.data.ruleSix == 2) {
                for (var i = 0; i < params.length; i++) {
                    for (var j = 0; j < navAlldata.length; j++) {
                        if (params[i] == navAlldata[j]) {
                            navAlldata.splice(j, 1)
                        }
                    }
                }
                params = navAlldata
            }
            return params
        },
        //单双
        dansClick: function() {
            var that = this
            $('input[name = seven1-all]').click(function() {
                $(this).siblings('input').prop('checked', false)
                $(this).parents().siblings().children('input[name = seven1-all]').prop('checked', false)
                that.data.ruleSeven1 = $(this).attr('data-id')
                if ($(this).prop('checked') == false) {
                    that.data.ruleSeven1 = '-1'
                }
                console.log(that.data.ruleSeven1)
                console.log($(this).prop('checked'))
            })
            $('input[name = seven2-all]').click(function() {
                $(this).siblings('input').prop('checked', false)
                $(this).parents().siblings().children('input[name = seven2-all]').prop('checked', false)
                that.data.ruleSeven2 = $(this).attr('data-id')
                if ($(this).prop('checked') == false) {
                    that.data.ruleSeven2 = '-1'
                }
                console.log(that.data.ruleSeven2)
                console.log($(this).prop('checked'))
            })
        },
        dansFun: function(navAlldata, dpInputGet) {
            var that = this
            var params = [];
            var dan = [1, 3, 5, 7, 9]
            var shuan = [0, 2, 4, 6, 8]
            if (that.data.ruleSeven1 != '-1' && that.data.ruleSeven2 != '-1') {
                return navAlldata;
            }
            if (that.data.ruleSeven1 == '-1' && that.data.ruleSeven2 == '-1') {
                return navAlldata
            }
            //初始化数据
            if (dpInputGet.num.length <= 0 && that.data.hfNum == '-1' && $('#noDing-inputs').val().length <= 0 &&
                that.data.ruleFour == '-1' && that.data.ruleFive == '-1' &&
                that.data.ruleSix == '-1') {
                navAlldata = that.getNavAlldata(dpInputGet)
            }
            if (that.data.ruleSeven1 == 1 || that.data.ruleSeven1 == 2) {
                var sevenOne = ['#seven1-one', '#seven1-two', '#seven1-three', '#seven1-four', '#seven1-five']
                var sevenPlace = []
                for (var i = 0; i < sevenOne.length; i++) {
                    if ($(sevenOne[i]).prop('checked') == true) {
                        sevenPlace.push($(sevenOne[i]).attr('data-id') - 1)
                    }
                }
                for (var i = 0; i < navAlldata.length; i++) {
                    switch (sevenPlace.length) {
                        case 1:
                            if (dan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 2:
                            if (dan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 3:
                            if (dan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[2]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 4:
                            if (dan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[2]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[3]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 5:
                            if (dan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[2]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[3]])) >= 0 &&
                                dan.indexOf(Number(navAlldata[i][sevenPlace[4]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                    }
                }
            }
            if (that.data.ruleSeven2 == 1 || that.data.ruleSeven2 == 2) {
                var sevenOne = ['#seven2-one', '#seven2-two', '#seven2-three', '#seven2-four', '#seven2-five']
                var sevenPlace = []
                for (var i = 0; i < sevenOne.length; i++) {
                    if ($(sevenOne[i]).prop('checked') == true) {
                        sevenPlace.push($(sevenOne[i]).attr('data-id') - 1)
                    }
                }
                for (var i = 0; i < navAlldata.length; i++) {
                    switch (sevenPlace.length) {
                        case 1:
                            if (shuan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 2:
                            if (shuan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 3:
                            if (shuan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[2]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 4:
                            if (shuan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[2]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[3]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                        case 5:
                            if (shuan.indexOf(Number(navAlldata[i][sevenPlace[0]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[1]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[2]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[3]])) >= 0 &&
                                shuan.indexOf(Number(navAlldata[i][sevenPlace[4]])) >= 0) {
                                params.push(navAlldata[i])
                            }
                            break;
                    }
                }
            }
            //除
            if (that.data.ruleSeven1 == 2 || that.data.ruleSeven2 == 2) {
                for (var i = 0; i < params.length; i++) {
                    for (var j = 0; j < navAlldata.length; j++) {
                        if (params[i] == navAlldata[j]) {
                            navAlldata.splice(j, 1)
                        }
                    }
                }
                params = navAlldata
            }
            return params
        },
        //遍历结果
        resultList: function(list) {
            var html = "";
            for (var key in list) {
                html += '<li>' + list[key] + '</li>'
            }
            $('.announce-result').html(html)
            $('.allaNum').text(list.length)
        },
        //判断两个数组是够有相同的数
        checkArr: function(arr1, arr2) {
            var rs = false;
            for (var i = 0; i < arr1.length; i++) {
                for (var j = 0; j < arr2.length; j++) {
                    if (arr1[i] == arr2[j]) {
                        rs = true;
                        break;
                    }
                }
            }
            return rs;
        },
        //去重
        removeSame: function(num) {
            let set = new Set(num)
            let newArr = Array.from(set)
            return newArr
        },
        //清除
        clear: function() {
            $('.clear').click(function() {
                // window.top.location.href = './home.html'   
                sessionStorage.setItem('fastUrl', 'fastSelect')
            })
        }
    }
}